/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * WeeklyDistPanel.java
 *
 * Created on Oct 25, 2009, 2:48:02 PM
 */

package trafficgeneratorcr.gui;

/**
 *
 * @author ccrisan
 */
public class WeeklyDistPanel extends javax.swing.JPanel {

    protected DailyDistPanel mondayDistPanel;
    protected DailyDistPanel tuesdayDistPanel;
    protected DailyDistPanel wednesdayDistPanel;
    protected DailyDistPanel thursdayDistPanel;
    protected DailyDistPanel fridayDistPanel;
    protected DailyDistPanel saturdayDistPanel;
    protected DailyDistPanel sundayDistPanel;
    protected WeeksDistPanel weeksDistPanel;

    /** Creates new form WeeklyDistPanel */
    public WeeklyDistPanel() {
        initComponents();
        
        mondayDistPanel = new DailyDistPanel("Monday");
        tuesdayDistPanel = new DailyDistPanel("Tuesday");
        wednesdayDistPanel = new DailyDistPanel("Wednesday");
        thursdayDistPanel = new DailyDistPanel("Thursday");
        fridayDistPanel = new DailyDistPanel("Friday");
        saturdayDistPanel = new DailyDistPanel("Saturday");
        sundayDistPanel = new DailyDistPanel("Sunday");
        weeksDistPanel = new WeeksDistPanel();

        jPanel1.add(mondayDistPanel);
//        jPanel1.add(tuesdayDistPanel);
//        jPanel1.add(wednesdayDistPanel);
//        jPanel1.add(thursdayDistPanel);
//        jPanel1.add(fridayDistPanel);
//        jPanel1.add(saturdayDistPanel);
//        jPanel1.add(sundayDistPanel);
//        jPanel1.add(weeksDistPanel);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jSpinner1 = new javax.swing.JSpinner();

        setLayout(new java.awt.BorderLayout());

        jPanel1.setLayout(new java.awt.GridLayout(1, 2));
        add(jPanel1, java.awt.BorderLayout.CENTER);

        jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel2.setPreferredSize(new java.awt.Dimension(400, 26));
        jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT, 5, 1));

        jLabel1.setText("Number of Packets: ");
        jPanel2.add(jLabel1);

        jSpinner1.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(1000), Integer.valueOf(0), null, Integer.valueOf(1000)));
        jSpinner1.setPreferredSize(new java.awt.Dimension(100, 20));
        jPanel2.add(jSpinner1);

        add(jPanel2, java.awt.BorderLayout.PAGE_START);
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JSpinner jSpinner1;
    // End of variables declaration//GEN-END:variables

    public double[][] getWeeklyDistributions() {
        double[][] weeklyDistributions = new double[7][];

        weeklyDistributions[0] = mondayDistPanel.getDailyDistribution();
        weeklyDistributions[1] = tuesdayDistPanel.getDailyDistribution();
        weeklyDistributions[2] = wednesdayDistPanel.getDailyDistribution();
        weeklyDistributions[3] = thursdayDistPanel.getDailyDistribution();
        weeklyDistributions[4] = fridayDistPanel.getDailyDistribution();
        weeklyDistributions[5] = saturdayDistPanel.getDailyDistribution();
        weeklyDistributions[6] = sundayDistPanel.getDailyDistribution();

        return weeklyDistributions;
    }

    public void setNumberOfWeeks(int numberOfWeeks) {
        weeksDistPanel.setNumberOfWeeks(numberOfWeeks);
    }

}
